﻿using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

namespace DatabaseGroup.UnitTests.SSIS.SourceAdapters
{
    /// <summary>
    /// Implements dummy IDTSCustomProperty90 functionality to aid testing
    /// </summary>
    public class CustomPropertyTestImpl : IDTSCustomProperty90
    {
        private int _id = 0;
        private string _name = string.Empty;
        private string _description = string.Empty;
        private bool _containsID = false;
        private bool _encryptionRequired = false;
        private DTSCustomPropertyExpressionType _expressionType = DTSCustomPropertyExpressionType.CPET_NONE;
        private DTSPersistState _state = DTSPersistState.PS_DEFAULT;
        private string _typeConverter = string.Empty;
        private string _uiTypeEditor = string.Empty;
        private object _value = null;

        #region IDTSCustomProperty90 Members

        public bool ContainsID
        {
            get { return _containsID; }
            set { _containsID = value; }
        }

        public string Description
        {
            get { return _description; }
            set { _description = value; }
        }

        public bool EncryptionRequired
        {
            get { return _encryptionRequired; }
            set { _encryptionRequired = value; }
        }

        public DTSCustomPropertyExpressionType ExpressionType
        {
            get { return _expressionType; }
            set { _expressionType = value; }
        }

        public int ID
        {
            get { return _id; }
            set { _id = value; }
        }

        public string IdentificationString
        {
            get { return string.Format("property \"{0}\" ({1})", this.ID, this.Name); }
        }

        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        public DTSObjectType ObjectType
        {
            get { return DTSObjectType.OT_PROPERTY; }
        }

        public DTSPersistState State
        {
            get { return _state; }
            set { _state = value; }
        }

        public string TypeConverter
        {
            get { return _typeConverter; }
            set { _typeConverter = value; }
        }

        public string UITypeEditor
        {
            get { return _uiTypeEditor; }
            set { _uiTypeEditor = value; }
        }

        public object Value
        {
            get { return this._value; }
            set { this._value = value; }
        }

        #endregion
    }
}
